package login;

import java.util.ArrayList;

public class Mylogin {
	private String id;
	private String pw;
	private String exe;
	private int result;
	private String nickName;
	private ArrayList<String> err = new ArrayList<String>();
	public static final int OK = 1;
	public static final int FAIL = 2;
	
	
	
	
	
	
	
	
	
	
	
	
	
	
	public static int getOk() {
		return OK;
	}
	public static int getFail() {
		return FAIL;
	}
	public int getResult() {
		return result;
	}
	public void setResult(int result) {
		this.result = result;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	public String getPw() {
		return pw;
	}
	public void setPw(String pw) {
		this.pw = pw;
	}
	public String getExe() {
		if(id==null || "".equals(id) ){
			err.add("id沒有填");
			result = Mylogin.FAIL;
		}
		if(pw==null || "".equals(pw) ){
			err.add("pw沒有填");
			result = Mylogin.FAIL;
		}
		
		if (err.size()==0){
			if (id.equals("John") && pw.equals("1234")){
				nickName = "醬";
				result = Mylogin.OK;
			}else{
				err.add("帳密不對");
				result = Mylogin.FAIL;
			}
		}
		return null;
	}
	public void setExe(String exe) {
		this.exe = exe;
	}
	public String getNickName() {
		return nickName;
	}
	public void setNickName(String nickName) {
		this.nickName = nickName;
	}
	public ArrayList<String> getErr() {
		return err;
	}
	public void setErr(ArrayList<String> err) {
		this.err = err;
	}
	
}